package org.linlinjava.litemall.db.service;

import org.linlinjava.litemall.db.dao.AgedmallCabinetGoodsMapper;
import org.linlinjava.litemall.db.domain.AgedmallCabinetGoods;
import org.linlinjava.litemall.db.domain.AgedmallCabinetGoodsExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;

@Service
public class AgedmallCabinetGoodsService {
    @Resource
    private AgedmallCabinetGoodsMapper agedmallCabinetGoodsMapper;

    public void updateStatByRfid(Long rfidId, Integer stat) {
        AgedmallCabinetGoodsExample example = new AgedmallCabinetGoodsExample();
        example.createCriteria().andDeletedEqualTo(false)
                .andGoodsRfidIdEqualTo(rfidId);
        AgedmallCabinetGoods cabinetGoods = new AgedmallCabinetGoods();
        cabinetGoods.setStat(stat);
        cabinetGoods.setUpdateTime(LocalDateTime.now());
        agedmallCabinetGoodsMapper.updateByExampleSelective(cabinetGoods, example);
    }
}
